<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<link href="/css/home/replacerecharge.css" media="screen" rel="stylesheet" type="text/css" > 
<script type="text/javascript" src="/js/boxy/js/jquery.boxy.js"></script>

<script type="text/javascript">
    $(function(){
        window.alert = Boxy.alert;
    });
    <?php if($this->ma == 1) { ?>
        alert("活动添加成功！");
        location.href="/admini/generalize/hotindex";
    <?php }?>
</script>
<div class="admin_nrtop">
    <div class="ad_search" style="font-size: 24px;">
        添加HOT商品
    </div>
</div>
<style>
    .add_div table{width: 960px;font-size: 16px;}
    .add_div table tr{height: 36px;}
    .add_div table .bf{text-align: right;margin-right: 5px;width:120px;}
    .add_div table input{font-size: 16px;width: 280px;}
    .add_div table select{font-size: 16px;width: 280px;}
    #getinfo{float: right;    height: 32px;    padding: 0 10px;}
</style>
<div  class="biaoge">
    <div class="add_div">
        <form action="/admini/generalize/addhot/" method="post">
           <div class="applytable">
                    <table>
                        <tr>
                            <td class="z">商品详情链接：</td>
                            <td>
                                <div class="input" style="border:0px;width: 650px;">                         
                                        <input class="required" type="text" id="itemurl" name="itemurl" style="width:450px;" placeholder="请粘贴商品详情链接"/>
                                        <button id="getinfo" type="button">获取信息</button>
                                        <span style="color: red;display: none;" id="error">获取失败！</span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">商品名称：</td>
                            <td>
                                <div class="input" style="border:0px;">     
                                        <input class="required" type="text" id="title" name="title"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">商品地址：</td>
                            <td>
                                <div class="input" style="border:0px;">                       
                                        <input class="required" type="text" id="url" name="url"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">商品价格：</td>
                            <td>
                                <div class="input" style="border:0px;">
                                        <input class="required" type="text" id="price" name="price"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">商品原价：</td>
                            <td>
                                <div class="input" style="border:0px;">
                                        <input class="required" type="text" id="cost" name="cost"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">商品图片：</td>
                            <td>
                                <div class="input" style="border:0px;">
                                        <input class="required" type="text" id="pict_url" name="pict_url"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">月销售量：</td>
                            <td>
                                <div class="input" style="border:0px;">                           
                                        <input class="required" type="text" id="volume" name="volume"/>
                                </div>
                            </td>
                        </tr>
                          <tr>
                            <td class="z">类型：</td>
                            <td>
                                <div class="input" style="border:0px;"> 
                                 <select id="type" name="type">
                                    <option value='1' >HOT热销</option>
                                    <option value='2' >聚划算</option>
                                </select>                            
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">&nbsp;</td>
                            <td>
                                <div class="botton" style="width:600px;">
                                    <input type="submit" value="添加">                                    
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
          </form>
    </div>
 </div>
<script>
$("#getinfo").click(function(){
    sVal=$("#itemurl").val();
    $.post("/purchase/getinfo",{url:sVal},function(data){
        if(data.success){//成功,设置             
          $("#title").val(data.name);
          $("#url").val(data.url);
          $("#price").val(data.price);
          $("#cost").val(data.price);
          $("#pict_url").val(data.image);
          //$("#volume").val(data.image);
          $("#error").hide();
        }else{
            $("#error").show();
        }
   
     });
});
</script>